import React, { Component } from 'react';
import {
  StyleSheet,
  View,
  Text,
  Platform,
  Image,
  Dimensions,
  ConsoleModule,
  Modal,
  TextInput,
} from '@hippy/react';

import { NativeNav } from '../../module/NativeNav';

const styles = StyleSheet.create({
  container: {
    width: 80,
    alignItems: 'center'
  },
  text: {
    marginTop: 4,
    textAlign: 'center',
    fontSize: 13
  }
});

export default class HomeFuncItem extends Component {
  constructor(props) {
    super(props);

  }

  _itemDidTapped = () => {
    NativeNav.push(this.props.text || "未知来源")
  };

  render() {
    const {img, text} = this.props;
    return (
      <View style={styles.container} onClick={this._itemDidTapped}>
        <Image
          style={{width: 50, height: 50}}
          source={{ uri: img }}
        />
        <Text style={styles.text}>{text}</Text>
    </View>
    );
  }
}
